package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.SkuImagesEntity;
import com.bush.mall.product.service.SkuImagesService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * sku图片
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("skuimages")
@Api(tags = "sku图片管理" )
public class SkuImagesController {

    @Resource(name= SkuImagesService.BEAN_ID)
    private SkuImagesService skuImagesService;

    /**
     * 分页查询sku图片列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询sku图片列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return skuImagesService.queryForPage(current,size);
    }

    /**
     * 保存sku图片表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存sku图片表单")
    @PostMapping("saveSkuImages")
    public Result saveSkuImages(@RequestBody SkuImagesEntity skuImages){
        return skuImagesService.saveSkuImages(skuImages);
    }

    /**
     * 修改sku图片表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改sku图片表单")
    @PutMapping("updateSkuImages")
    public Result updateSkuImages(@RequestBody SkuImagesEntity skuImages){
        return skuImagesService.updateSkuImages(skuImages);
    }

    /**
     * 通过指定id删除sku图片
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除sku图片")
    @DeleteMapping("deleteSkuImages")
    public Result deleteSkuImages(Long id){
        return skuImagesService.deleteSkuImages(id);
    }

}
